using System;
using UnityEngine;

public class TMoveAction : TAction
{
	private GPObject previousObj;
	
	public TMoveAction (TObject o) : base (o){}
	
	public TMoveAction (TObject prevO, TObject o){
		previousObj = (GPObject)(prevO);
		this.tobj = o;
	}
	
	public override void undo(){
		GPObject gpo = (GPObject)(tobj);
		GhostsHandler.Instance.destroyGhost(gpo.Id);
		GhostsHandler.Instance.createGhost(previousObj);
	}
	
	public override void redo(){
		GPObject gpo = (GPObject)(tobj);
		GhostsHandler.Instance.destroyGhost(gpo.Id);
		GhostsHandler.Instance.createGhost(gpo);
	}
	
	public override string ToString ()
	{
		return string.Format ("[TMoveAction] : {1}", tobj.ToString());
	}
}

